﻿'
' Will Strohl (will.strohl@gmail.com)
' http://www.willstrohl.com
'
'Copyright (c) 2011, Will Strohl
'All rights reserved.
'
'Redistribution and use in source and binary forms, with or without modification, are 
'permitted provided that the following conditions are met:
'
'Redistributions of source code must retain the above copyright notice, this list of 
'conditions and the following disclaimer.
'
'Redistributions in binary form must reproduce the above copyright notice, this list 
'of conditions and the following disclaimer in the documentation and/or other 
'materials provided with the distribution.
'
'Neither the name of Will Strohl nor the names of its contributors may be 
'used to endorse or promote products derived from this software without specific prior 
'written permission.
'
'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
'EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
'OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
'SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
'INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
'TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
'BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
'CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
'ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
'DAMAGE.
'

Imports DotNetNuke.Services.Exceptions

Namespace WillStrohl.Modules.CodeCamp

    Partial Public MustInherit Class EditCodeCamp
        Inherits WNSPortalModuleBase

#Region " Private Members "

        Private p_CodeCamp As CodeCampInfo
        Private p_RolesHandler As String = Null.NullString
        Private p_CodeCampHandler As String = Null.NullString

#End Region

#Region " Private Properties "

        Protected Property CodeCamp As CodeCampInfo
            Get
                Return Me.p_CodeCamp
            End Get
            Set(ByVal value As CodeCampInfo)
                Me.p_CodeCamp = value
            End Set
        End Property

        Protected ReadOnly Property RolesHandler() As String
            Get
                If Not String.IsNullOrEmpty(Me.p_RolesHandler) Then
                    Return Me.p_RolesHandler
                End If

                Me.p_RolesHandler = String.Concat(Me.ModulePathFull, "Roles.ashx")

                Return Me.p_RolesHandler
            End Get
        End Property

        Protected ReadOnly Property CodeCampHandler() As String
            Get
                If Not String.IsNullOrEmpty(Me.p_CodeCampHandler) Then
                    Return Me.p_CodeCampHandler
                End If

                Me.p_CodeCampHandler = String.Concat(Me.ModulePathFull, "CodeCamp.ashx")

                Return Me.p_CodeCampHandler
            End Get
        End Property

#End Region

#Region " Event Handlers "

        Private Sub Page_Load(ByVal Sender As Object, ByVal E As System.EventArgs) Handles Me.Load
            Try

                Me.RegisterCSS("jQuery.UI", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/ui-lightness/jquery-ui.css")

                Me.RegisterClientScript("jQuery.Plugin.Tooltip", String.Concat(Me.ControlPath, "js/jquery.hintbox.js"))

                Me.RegisterClientScript("jQuery.Plugin.MaskedInput", String.Concat(Me.ControlPath, "js/jquery.maskedinput.min.js"))

                Me.RegisterClientScript("jQuery.Plugin.TimePicker", String.Concat(Me.ControlPath, "js/jquery.ui.timepicker.js"))
                Me.RegisterCSS("jQuery.UI.Timepicker", String.Concat(Me.ControlPath, "js/jquery.ui.timepicker.css"))

                Me.RegisterClientScript("DNNCodeCampCore", String.Concat(Me.ControlPath, "js/DNNCodeCamp.Core.js"))

                Me.RegisterClientScript("EditCodeCamp", String.Concat(Me.ControlPath, "js/View.EditCodeCamp.js"))

                If Not Page.IsPostBack Then

                    Dim strCodeCamp As String = Request.QueryString("ccid")
                    If Not String.IsNullOrEmpty(strCodeCamp) Then
                        Dim ctlCodeCamp As New CodeCampController
                        Me.p_CodeCamp = ctlCodeCamp.GetCodeCampById(Integer.Parse(strCodeCamp, Globalization.NumberStyles.Integer))
                    Else
                        Me.p_CodeCamp = New CodeCampInfo
                    End If

                End If

                If Not Page.IsPostBack Then
                    Me.BindData()
                End If

            Catch exc As Exception ' Module failed to load
                ProcessModuleLoadException(Me, exc, Me.IsEditable)
            End Try
        End Sub

#End Region

#Region " Helper Methods "

        Private Sub BindData()

            Me.LocalizeModule()

        End Sub

        Private Sub LocalizeModule()



        End Sub

#End Region

    End Class

End Namespace